package ubcns.lib.thread;

import android.os.Handler;

public class AccumThread extends Thread{
	int mStart, mEnd;
	int mResult;;
	Handler mAfter;
	public boolean mQuit;
	
	AccumThread(int start, int end, Handler after){
		mStart = start;
		mEnd = end;
		mQuit = false;
		mAfter = after;
	}
	
	public void run(){
		mResult = 0;
		for(int i = mStart; i <= mEnd; i++){
			mResult += i;
			try{
				Thread.sleep(20);
			}catch(InterruptedException e){
				;
			}
			if(mQuit){
				return;
			}
		}
		mAfter.sendEmptyMessage(0);
	}
}
